'
' DotNetNuke Ita - http://dotnetnukeita.blogspot.com
' Daniele Lembo
'

Imports DotNetNuke
Imports System.Web.UI
Imports System.Collections.Generic
Imports System.Reflection
Imports DotNetNuke.Entities.Modules
Imports DotNetNukeIta.Modules
Imports DotNetNukeIta.Modules.RSSNuke.Controllers
Imports DotNetNukeIta.Modules.RSSNuke


Namespace DotNetNukeIta.Modules.RSSNuke

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' The ViewDynamicModule class displays the content
    ''' </summary>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Partial Class ViewRSSNuke
        Inherits Entities.Modules.PortalModuleBase
        Implements Entities.Modules.IActionable


#Region "Private Members"


#End Region

#Region "Event Handlers"

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' Page_Load runs when the control is loaded
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Try
                If Not Page.IsPostBack Then


                    ''*****controllo permessi*****
                    'Dim ms As RSSNukeController
                    'Dim objModules As ModuleController
                    'Dim objMudule As ModuleInfo

                    'ms = New RSSNukeController()
                    'objModules = New ModuleController()

                    'objMudule = objModules.GetModule(ModuleId, TabId, False)
                    'ms.ModuleSecurity(objMudule)

                    'If ms.PermessoDiDemo = False Then
                    '    Response.Redirect(NavigateURL())
                    'End If
                    ''*****controllo permessi*****

                    Dim ctrlRss As New Controllers.RSSNukeController
                    Dim objRSSFeed As RSSFeed


                    objRSSFeed = ctrlRss.GetRSSFeeds(TabModuleId)

                    hlFeedLink.Text = objRSSFeed.Title
                    hlFeedLink.NavigateUrl = objRSSFeed.Url
                    hlFeedLink.Target = "_new"

                    lstContent.DataSource = objRSSFeed.Feeds
                    lstContent.DataBind()

                    'Dim DemoCTRL As New RSSNukeController
                    'DemoCTRL.UpgradeModule("01.00.01")


                    Dim objModules As New Entities.Modules.ModuleController

                    Dim imgW As Integer = CType(objModules.GetTabModuleSettings(TabModuleId)("imgW"), String)
                    Dim imgH As Integer = CType(objModules.GetTabModuleSettings(TabModuleId)("imgH"), String)
                    Dim imgCapW As Integer = CType(objModules.GetTabModuleSettings(TabModuleId)("imgCapW"), String)
                    Dim imgCapH As Integer = CType(objModules.GetTabModuleSettings(TabModuleId)("imgCapH"), String)

                    ImageThumb.Width = imgW
                    ImageThumb.Height = imgH
                    ImageThumb.AlternateText = objRSSFeed.Url
                    ImageThumb.ImageUrl = ResolveUrl("SnapShot.aspx?site=" & QueryStringEncode(objRSSFeed.Url.Replace("http://", "")) & "&width=" & imgW & "&height=" & imgH & "&capWidth=" & imgCapW & "&capHeight=" & imgCapH & "")

                End If
            Catch exc As Exception
                ProcessModuleLoadException(Me, exc)
            End Try
        End Sub

#End Region

#Region "Optional Interfaces"

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' Registers the module actions required for interfacing with the portal framework
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public ReadOnly Property ModuleActions() As Entities.Modules.Actions.ModuleActionCollection Implements Entities.Modules.IActionable.ModuleActions
            Get
                Dim Actions As New Entities.Modules.Actions.ModuleActionCollection
                'TODO: Add additional actions here
                'Actions.Add(GetNextActionID, Localization.GetString(Entities.Modules.Actions.ModuleActionType.AddContent, LocalResourceFile), Entities.Modules.Actions.ModuleActionType.ddContent, "", "", NavigateURL(), False, Security.SecurityAccessLevel.View, True, False)
                Return Actions
            End Get
        End Property

#End Region

    End Class

End Namespace
